/*************************************************
Author: byron
Date: 08/15/2013
Description:
Notes: 
*************************************************/

#ifndef __CDayWishCfg_h__
#define __CDayWishCfg_h__

#include "commclass.h"
#include "CTArray.h"

class CDayWishCfgData
{
public:
    CDayWishCfgData() 
    {
        Clear();
    }

    void Clear()
    {
        _iID = 0;
        _iItemType = 0;
        _iItemNum = 0;
        _uiItemID = 0;
        _astItemList.Clear();
    }

    virtual ~CDayWishCfgData() 
    {
    }

    bool IsValidID() const {return (_iID > 0);}
    int CheckValidData();

    int GetID() const {return _iID;}
    int GetItemType() const {return _iItemType;}
    int GetItemNum() const {return _iItemNum;}
    unsigned int GetItemID() const {return _uiItemID;}

    void SetID(int iVal) {_iID = iVal;}
    void SetItemType(int iVal) {_iItemType = iVal;}
    void SetItemNum(int iVal) {_iItemNum = iVal;}
    void SetItemID(unsigned int uiVal) {_uiItemID = uiVal;}

    int GetItemSize() const {return _astItemList.Size();}
    CDropItemData& GetLoginItem(int iIndex)
    {
        return _astItemList[iIndex];
    }
    void AddLoginItem(int iType, int iNum, unsigned int uiID) 
    {
        CDropItemData stItemData;
        stItemData._ucItemType = (unsigned char)iType;
        stItemData._usItemConfigID = (unsigned short)uiID;
        stItemData._iItemCount = iNum;
        _astItemList.AddOneItem(stItemData);
    }

private:
    int             _iID;
    int             _iItemType;
    int             _iItemNum;
    unsigned int    _uiItemID;
    CTLib::CTArray<CDropItemData, MAX_LOGIN_REWARD_ITEM_COUNT> _astItemList;
};

class CDayWishCfg
{
public:
    CDayWishCfg() 
    {
        Clear();
    }

    void Clear()
    {
        _astDayWishCfg.Clear();
    }

    virtual ~CDayWishCfg() 
    {
    }

    int GetConfigSize() const {return _astDayWishCfg.Size();}
    int AddConfig(CDayWishCfgData& stCfgData);
    int FindConfig(int iID);
    CDayWishCfgData& GetConfig(int iIndex);

private:
    CTLib::CTArray<CDayWishCfgData, MAX_DAY_WISH_CONFIG_COUNT> _astDayWishCfg;
};

#endif // __CDayWishCfg_h__

